package com.huazi.www.frontdesk.servlet;

import com.huazi.www.frontdesk.javaBase.ConsumeInfo;
import com.huazi.www.frontdesk.javaBase.DepartmentInfo;
import com.huazi.www.frontdesk.javaBase.PageInfo;
import com.huazi.www.frontdesk.javaBase.QueueInfo;
import com.huazi.www.frontdesk.service.impl.FrontdeskCardServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 缴费状况Servlet
 */
public class ConsumeServlet extends HttpServlet {
    FrontdeskCardServiceImpl frontdeskCardService = new FrontdeskCardServiceImpl();

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }

    @Override
    public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("UTF-8"); //修改request域的编码集
        resp.setContentType("text/thml;charse=UTF-8");//修改respones域的编码集
        String name = req.getParameter("stateName");//获取用户名
        String curr = req.getParameter("curr");//获取当前页码
        if (name == null || name == "") {
            name = "";
        }
        if (curr == null || curr == "") {
            curr = "1";
        }
        PageInfo<ConsumeInfo> pageconsume = frontdeskCardService.pageconsume(name, Integer.parseInt(curr));//new frontdeskCardService类pageconsume方法
        req.setAttribute("pageconsume", pageconsume); //保存page对象
        req.setAttribute("consumename", name);//保存条件 name
        req.getRequestDispatcher("frontdesk/paythefees.jsp").forward(req, resp);//转发至paythefees.jsp页面
    }

}
